import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 审核填报信息 */
export interface AuditPlanDetail {
          id: number; // id
          auditTypeId: number; // 分类
          auditTypeName: string; // 分类名称
          configId: number; // 审核项
          configName: string; // 审核项
          auditResult: string; // 审核结果
          remark: string; // 问题简述
          dutyUserId: number; // 责任人
          planDate: string | Dayjs; // 计划完成时间
          files: string; // 附件
          planAreaId: number; // 计划区域
          problemImg: string; // 不符合图片
          deductPoints: number; // 扣分
          repairDeptId: number; // 整改部门
          repairDeptName: string; // 整改部门
          takeWay: string; // 措施
          repairImg: string; // 整改图片
          completeStatus: number; // 完成状态
          problemRemark: string; // 问题备注
          auditUserId: string; // 审核人
          auditUserName: string; // 审核人
          auditStatus: number; // 审核状态
          auditRemark: string; // 审核备注
          auditTime: string | Dayjs; // 审核时间
  }

// 审核填报 API
export const AuditPlanDetailApi = {
  // 查询审核填报分页
  getAuditPlanDetailPage: async (params: any) => {
    return await request.get({ url: `/business/audit-plan-detail/page`, params })
  },

  // 查询审核填报详情
  getAuditPlanDetail: async (id: number) => {
    return await request.get({ url: `/business/audit-plan-detail/get?id=` + id })
  },

  // 新增审核填报
  createAuditPlanDetail: async (data: AuditPlanDetail) => {
    return await request.post({ url: `/business/audit-plan-detail/create`, data })
  },

  // 修改审核填报
  updateAuditPlanDetail: async (data: AuditPlanDetail) => {
    return await request.put({ url: `/business/audit-plan-detail/update`, data })
  },

  // 删除审核填报
  deleteAuditPlanDetail: async (id: number) => {
    return await request.delete({ url: `/business/audit-plan-detail/delete?id=` + id })
  },

  /** 批量删除审核填报 */
  deleteAuditPlanDetailList: async (ids: number[]) => {
    return await request.delete({ url: `/business/audit-plan-detail/delete-list?ids=${ids.join(',')}` })
  },

  // 导出审核填报 Excel
  exportAuditPlanDetail: async (params) => {
    return await request.download({ url: `/business/audit-plan-detail/export-excel`, params })
  }
}